package com.study4j.common.exception;

import com.study4j.common.enums.IEnumCode;

/**
 * @description 异常基础类
 * @author Jiangbin
 * @date 2019年10月7日 下午9:47:11
 */
public class BaseException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	/**
	 * 异常状态码
	 */
	IEnumCode code;
	/**
	 * 异常信息
	 */
	String message;
	/**
	 * 异常时的解决方案
	 */
	String solution;

	public BaseException() {
	}

	public BaseException(String message) {
		super(message);
		this.message = message;
	}

	public BaseException(IEnumCode code, String message) {
		super(message);
		this.code = code;
		this.message = message;
	}

	public BaseException(Throwable message) {
		super(message);
	}

	public BaseException(IEnumCode code) {
		super(code.getMessage());
		this.message = code.getMessage();
		this.code = code;

	}

	public BaseException(IEnumCode code, String message, String solution) {
		super(code.getMessage());
		this.message = message;
		this.code = code;
	}

	public IEnumCode getCode() {
		return this.code;
	}

	public void setCode(IEnumCode code) {
		this.code = code;
	}

	@Override
	public String getMessage() {
		return this.message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getSolution() {
		return solution;
	}

	public void setSolution(String solution) {
		this.solution = solution;
	}
}